package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the CLASSIFY_PRODUCT_TB database table.
 * 
 */
@Entity
@Table(name="CLASSIFY_PRODUCT_TB")
@NamedQuery(name="ClassifyProductTb.findAll", query="SELECT c FROM ClassifyProductTb c")
public class ClassifyProductTb implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue=1,allocationSize=1,name="CLASSIFY_PRODUCT_TB_CLASSIFYID_GENERATOR", sequenceName="SEQ_8")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CLASSIFY_PRODUCT_TB_CLASSIFYID_GENERATOR")
	@Column(name="CLASSIFY_ID")
	private long classifyId;//主键

	@Column(name="CLASSIFY_NAME")
	private String classifyName;//分类名称

	//bi-directional many-to-one association to Product
	@OneToMany(mappedBy="classifyProductTb")
	private List<Product> products;//产品表

	public ClassifyProductTb() {
	}

	public long getClassifyId() {
		return this.classifyId;
	}

	public void setClassifyId(long classifyId) {
		this.classifyId = classifyId;
	}

	public String getClassifyName() {
		return this.classifyName;
	}

	public void setClassifyName(String classifyName) {
		this.classifyName = classifyName;
	}

	public List<Product> getProducts() {
		return this.products;
	}

	public void setProducts(List<Product> products) {
		this.products = products;
	}

	public Product addProduct(Product product) {
		getProducts().add(product);
		product.setClassifyProductTb(this);

		return product;
	}

	public Product removeProduct(Product product) {
		getProducts().remove(product);
		product.setClassifyProductTb(null);

		return product;
	}

}